package com.ruoyi.project.data.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.data.mapper.WeightManagementMapper;
import com.ruoyi.project.data.domain.WeightManagement;
import com.ruoyi.project.data.service.IWeightManagementService;

/**
 * 管理制度文本与组织结构图Service业务层处理
 * 
 * @author ruoyi
 * @date 2020-04-26
 */
@Service
public class WeightManagementServiceImpl implements IWeightManagementService 
{
    @Autowired
    private WeightManagementMapper weightManagementMapper;

    /**
     * 查询管理制度文本与组织结构图
     * 
     * @param id 管理制度文本与组织结构图ID
     * @return 管理制度文本与组织结构图
     */
    @Override
    public WeightManagement selectWeightManagementById(Long id)
    {
        return weightManagementMapper.selectWeightManagementById(id);
    }

    /**
     * 查询管理制度文本与组织结构图列表
     * 
     * @param weightManagement 管理制度文本与组织结构图
     * @return 管理制度文本与组织结构图
     */
    @Override
    public List<WeightManagement> selectWeightManagementList(WeightManagement weightManagement)
    {
        return weightManagementMapper.selectWeightManagementList(weightManagement);
    }

    /**
     * 新增管理制度文本与组织结构图
     * 
     * @param weightManagement 管理制度文本与组织结构图
     * @return 结果
     */
    @Override
    public int insertWeightManagement(WeightManagement weightManagement)
    {
        weightManagement.setCreateTime(DateUtils.getNowDate());
        weightManagement.setCreateBy(String.valueOf(SecurityUtils.getLoginUser().getUser().getUserId()));
        return weightManagementMapper.insertWeightManagement(weightManagement);
    }

    /**
     * 修改管理制度文本与组织结构图
     * 
     * @param weightManagement 管理制度文本与组织结构图
     * @return 结果
     */
    @Override
    public int updateWeightManagement(WeightManagement weightManagement)
    {
        weightManagement.setUpdateTime(DateUtils.getNowDate());
        weightManagement.setUpdateBy(String.valueOf(SecurityUtils.getLoginUser().getUser().getUserId()));
        return weightManagementMapper.updateWeightManagement(weightManagement);
    }

    /**
     * 批量删除管理制度文本与组织结构图
     * 
     * @param ids 需要删除的管理制度文本与组织结构图ID
     * @return 结果
     */
    @Override
    public int deleteWeightManagementByIds(Long[] ids)
    {
        return weightManagementMapper.deleteWeightManagementByIds(ids);
    }

    /**
     * 删除管理制度文本与组织结构图信息
     * 
     * @param id 管理制度文本与组织结构图ID
     * @return 结果
     */
    @Override
    public int deleteWeightManagementById(Long id)
    {
        return weightManagementMapper.deleteWeightManagementById(id);
    }

    @Override
    public int updateWeightManagementById(Long[] ids)
    {
        return weightManagementMapper.updateWeightManagementByIds(ids);
    }
}
